/**
 * 监听元素宽高变化，在需要监听的div上加 v-resize
 */
export const resize = {
    // el：绑定的元素，bingding：绑定给指令的对象
    bind(el, binding) {
        let width = '';
        let height = '';
        function isResize() {
            const style = document.defaultView.getComputedStyle(el);
            if (width !== style.width || height !== style.height) {
                binding.value();
            }
            width = style.width;
            height = style.height;
        }
        // 每300毫秒执行一次
        el.__vueSetinterval__ = setInterval(isResize, 300);
    },
    unbind(el) {
        clearInterval(el.__vueSetinterval__);
    }
};

export default {};